#********************************************
#
# function or macro
#
#********************************************
if(IS_DEFINED_add_executable)
function(_add_executable name)
	__add_executable(${ARGV})
	list(FIND ARGV "IMPORTED" IMPORTED_IDX)
	list(FIND ARGV "ALIAS" ALIAS_IDX)
	if(NOT (IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1))
		return()
	endif()
	set_source_folder_auto(${ARGV})
	if(CURRENT_PROJECT_FOLDER)
		set_project_folder(${name} ${CURRENT_PROJECT_FOLDER})
	endif()
	set_target_properties(${name} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endfunction()

function(_add_library name)
	__add_library(${ARGV})
	list(FIND ARGV "IMPORTED" IMPORTED_IDX)
	list(FIND ARGV "ALIAS" ALIAS_IDX)
	list(FIND ARGV "INTERFACE" INTERFACE_IDX)
	if(NOT (IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1))
		return()
	endif()
	set_source_folder_auto(${ARGV})
	if(CURRENT_PROJECT_FOLDER)
		set_project_folder(${name} ${CURRENT_PROJECT_FOLDER})
	endif()
endfunction()
else()
function(add_executable name)
	_add_executable(${ARGV})
	list(FIND ARGV "IMPORTED" IMPORTED_IDX)
	list(FIND ARGV "ALIAS" ALIAS_IDX)
	if(NOT (IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1))
		return()
	endif()
	set_source_folder_auto(${ARGV})
	if(CURRENT_PROJECT_FOLDER)
		set_project_folder(${name} ${CURRENT_PROJECT_FOLDER})
	endif()
	set_target_properties(${name} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endfunction()

function(add_library name)
	_add_library(${ARGV})
	list(FIND ARGV "IMPORTED" IMPORTED_IDX)
	list(FIND ARGV "ALIAS" ALIAS_IDX)
	list(FIND ARGV "INTERFACE" INTERFACE_IDX)
	if(NOT (IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1))
		return()
	endif()
	set_source_folder_auto(${ARGV})
	if(CURRENT_PROJECT_FOLDER)
		set_project_folder(${name} ${CURRENT_PROJECT_FOLDER})
	endif()
endfunction()
endif()
